<template>
  <h1>大文件上传</h1>
  <input type="file" @change="handleChange">
</template>
<script lang='ts' setup>
import {createFileChunks,calcChunksHash,uploadChunks} from './utils/upload'
const handleChange=async(e:Event)=>{
   const files=(e.target as HTMLInputElement).files
   if(!files){
     return 
   }
   const file=files[0]
   const chunkList=createFileChunks(file)
   const hash=await calcChunksHash(chunkList)
   let suffixResult=/\.([0-9A-z]+)$/.exec(file.name)
   if(suffixResult){
     uploadChunks(chunkList,hash,suffixResult[1])
   }
}
</script>
<style lang='scss' scoped>
</style>